<?php


namespace App\Http\Requests\Customer\Product\Index;


use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class StoreRequest extends FormRequest
{
    public function rules()
    {
        return [
            'customer_id' => ['required'],
            'sku' => ['required', Rule::unique('products')->where('customer_id', $this->get('customer_id'))],
            'name' => ['required'],
            'unit' => ['required'],
            'condition' => ['required'],
            'validity' => ['required'],
            'lockup_validity' => ['required', 'integer'],
            'images' => ['nullable', 'array', 'max:5'],
        ];
    }
}
